home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: Character String --> Integer
- Date: Thu, 22 Feb 96 00:37:00 GMT
- Organization: none
- Message-ID: <824949420snz@genesis.demon.co.uk>
- References: <4fb0ga$lsa@remus.rutgers.edu> <4ffr4e$4ji@madeline.INS.CWRU.Edu> <1996Feb20.185030.22691@cs.mun.ca>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <1996Feb20.185030.22691@cs.mun.ca>
- sjt@cs.mun.ca "Stephen J. Tremblett" writes:
-
- >
- >
- >
- >I did this very recently in an assig.
- >A char variable is just an int interpreted into the values of the ascii
- >table. A char variable - 48 (ascii for 0) will result in the integer
- >value of that digit.
-
- But there is no need to know or even care what the ASCII calue for 0 is.
- Just subtract '0' from the digit value and it will give you the integer
- value whatever the underlying character set.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-